<template>
  <div id="app">
    <keep-alive>
      <!-- 这里是会被缓存的视图组件，比如 page1,page2 -->
      <router-view v-if="$route.meta.keepAlive && isShow" />
    </keep-alive>
    <!-- 这里是不被缓存的视图组件，比如 page3 -->
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isShow: true,
    };
  },
  provide() {
    return {
      reload: this.pageReload,
    };
  },
  methods: {
    // 无感刷新
    pageReload() {
      this.isShow = false;
      this.$nextTick(() => {
        this.isShow = true;
      });
    },
  },
};
</script>
